package cn.wyl.controller;

import cn.wyl.domain.Pay;
import cn.wyl.domain.User;
import cn.wyl.feignclient.IUserFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/pay")
public class PayController {

    @Autowired
    private IUserFeignClient userFeignClient;

    @GetMapping("/{id}")
    public Pay getPay(@PathVariable("id") Long id){
        //希望发起远程调用获取User对象
        User user = userFeignClient.get(id);
        return new Pay(id,"支付宝支付666元",user);
    }
}
